﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CLUBsInterpreter.AST;

namespace CLUBsInterpreter.ObjectTypes
{
	/**
	 * <summary>
	 * Describes a library object loaded in the CLUBs environment.
	 * </summary>
	 **/
	class CLUBsLibrary : CLUBsObject
	{
		public CLUBsNode LibraryAST;

		/**
		 * <summary>
		 * Default constructor creates empty library.
		 * </summary>
		 **/
		public CLUBsLibrary()
		{
			// Set the object identifier type
			ObjectIdentifierType = AST.IdentifierType.Library;
		}

		/**
		 * <see cref="CLUBsObject.CopyValueFromObject"/>
		 **/
		public override void CopyValueFromObject(CLUBsObject obj)
		{
            CLUBsLibrary libraryObj = (CLUBsLibrary)obj;
            LocalVariables.Clear();
            foreach (KeyValuePair<string, CLUBsObject> var in obj.LocalVariables)
            {
                LocalVariables.Add(var.Key, var.Value);
            }
		}
	}
}
